package sistemadeleiloes.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Database {

    public static Connection getConnection() {

        try{
            Class.forName("com.mysql.jdbc.Driver");
            return DriverManager.getConnection("jdbc:mysql://localhost/SistemaDeLeiloes","root","root");
        }
        catch(ClassNotFoundException | SQLException e){
        System.out.println("Erro ao carregar driver de conexão. \nDetalhes: "
        + e);
        }
        
        return null;
        /*try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            /*return DriverManager
             .getConnection("jdbc:sqlserver://localhost:1433;"
             + "databaseName=SistemaDeLeiloes;" + "user=user;"
             + "password=ss123456");*/
            /*return DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=SistemaDeLeiloes;user=user;password=ss123456;");
        } catch (Exception e) {
            System.out
                    .println("Erro ao carregar driver de conexão. \nDetalhes: "
                    + e);
        }
        return null;*/
    }
}
